package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 自媒体图文统计
 *
 * @author : ZhongYu,yangkexuan //作者
 * @ClassName : StatisticsController  //类名
 * @Description : 自媒体图文统计  //描述
 * @Date: 2023/8/3  9:26
 */
@RestController
@RequestMapping("/api/v1/statistics")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;

    /**
     * 数据
     *
     * @Params:
     * @Return
     */
    @GetMapping("/newsDimension")
    public ResponseResult newsDimension(@RequestParam(value = "beginDate") String beginDate,
                                        @RequestParam(value = "endDate") String endDate) {
        return statisticsService.newsDimension(beginDate, endDate);
    }

    /**
     * 文章统计
     * @param beginDate
     * @param endDate
     * @param page
     * @param size
     * @return
     */
    @GetMapping("/newsPage")
    public ResponseResult newsPage(@RequestParam(value = "beginDate") String beginDate,
                                   @RequestParam(value = "endDate") String endDate,
                                   @RequestParam(value = "page") Integer page,
                                   @RequestParam(value = "size") Integer size) {
        return statisticsService.newsPage(page,size,beginDate,endDate);

    }

    /**
     * 详细信息
     * @return
     */
    @GetMapping("/newsDetail")
    public ResponseResult newsDetail(@RequestParam(value = "id") String id,
                                     @RequestParam(value = "beginDate") String beginDate,
                                     @RequestParam(value = "endDate") String endDate){
        return statisticsService.newsDetail(id,beginDate,endDate);
    }
}
